#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName  :decorators.py
# @Time      :2025/2/17 18:17
# @Author    :kk
from functools import wraps
from flask import g, redirect, url_for


def login_required(func):
    @wraps(func)
    def inner(*args,**kwargs):
        if g.user:
            return func(*args,**kwargs)
        else:
            print("请先登录")
            return redirect(url_for("auth.login"))
    return inner
